<template>
    <div>sub vite ts</div>
    <div>main view</div>
    <div>{{ store_user.user }}</div>
    <button v-on:click="btnGet">獲取</button>
    <button v-on:click="btn">修改</button>
</template>

<script setup lang="ts">
import { PROJECT_KEY } from '@/config'
import { useUserStore } from '@glz/utils'
import { type User } from '@glz/utils'
import { ref } from 'vue' 

const user = ref({} as User)

const store_user = useUserStore(PROJECT_KEY)

const btn = () => {

    user.value = {
        token :PROJECT_KEY,
        id: '12222',
        account:'',
        mobile:'85258',
        avator: ''
    }

    store_user.setUser(user.value)

    store_user.updateFromSubApp();
}

const btnGet = () => {

    //console.log(store)
    //user.value = store.user
}

</script>